﻿using System;
using SassAndCoffee;

namespace Telerik.Web.Mvc.UI {
    public static class SassRegistrarBuilder {
        private static SassFileCompiler _compiler = new SassFileCompiler();

        public static StyleSheetRegistrarBuilder Sass(this StyleSheetRegistrarBuilder styleSheetRegistrar, Action<SassCollectionBuilder> configureAction) {
            var registrar = (StyleSheetRegistrar)styleSheetRegistrar;

            SassCollectionBuilder builder = new SassCollectionBuilder(WebAssetType.StyleSheet, registrar.StyleSheets, _compiler);

            configureAction(builder);

            return styleSheetRegistrar;
        }

        public static StyleSheetRegistrarBuilder DefaultSassGroup(this StyleSheetRegistrarBuilder styleSheetRegistrar, Action<SassAndCoffeeGroupBuilder> configureAction) {
            var registrar = (StyleSheetRegistrar)styleSheetRegistrar;

            SassAndCoffeeGroupBuilder builder = new SassAndCoffeeGroupBuilder(registrar.DefaultGroup, _compiler);

            configureAction(builder);

            return styleSheetRegistrar;
        }
    }
}